// $ANTLR 3.3 Nov 30, 2010 12:50:56 D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g 2012-06-13 21:52:05

  package logoparsing;
  import logogui.Traceur;
  import logogui.Context;
  import logogui.Procedure;
  import java.util.Map;
  import java.util.HashMap;
  import logogui.Log;
  import java.util.Collection;
  import java.util.Iterator;
  import java.util.Vector;


import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;


import org.antlr.runtime.tree.*;

public class LogoParser extends Parser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "PROGRAMME", "AV", "TD", "TG", "LC", "BC", "REC", "FPOS", "FCAP", "CAP", "VE", "MT", "CT", "FCC", "HASARD", "REPETE", "LOOP", "TANTQUE", "POUR", "FIN", "RETURN", "IF", "SIN", "DONNE", "LOCALE", "GUILLEMETS", "POINTS", "EGAL", "INF", "SUP", "DIFF", "INFEQ", "SUPEQ", "PLUS", "MINUS", "MULT", "DIV", "LISTE", "INSTR", "PARAMS", "VALUES", "REEL", "CHAINE", "WS", "'('", "')'", "'['", "']'"
    };
    public static final int EOF=-1;
    public static final int T__48=48;
    public static final int T__49=49;
    public static final int T__50=50;
    public static final int T__51=51;
    public static final int PROGRAMME=4;
    public static final int AV=5;
    public static final int TD=6;
    public static final int TG=7;
    public static final int LC=8;
    public static final int BC=9;
    public static final int REC=10;
    public static final int FPOS=11;
    public static final int FCAP=12;
    public static final int CAP=13;
    public static final int VE=14;
    public static final int MT=15;
    public static final int CT=16;
    public static final int FCC=17;
    public static final int HASARD=18;
    public static final int REPETE=19;
    public static final int LOOP=20;
    public static final int TANTQUE=21;
    public static final int POUR=22;
    public static final int FIN=23;
    public static final int RETURN=24;
    public static final int IF=25;
    public static final int SIN=26;
    public static final int DONNE=27;
    public static final int LOCALE=28;
    public static final int GUILLEMETS=29;
    public static final int POINTS=30;
    public static final int EGAL=31;
    public static final int INF=32;
    public static final int SUP=33;
    public static final int DIFF=34;
    public static final int INFEQ=35;
    public static final int SUPEQ=36;
    public static final int PLUS=37;
    public static final int MINUS=38;
    public static final int MULT=39;
    public static final int DIV=40;
    public static final int LISTE=41;
    public static final int INSTR=42;
    public static final int PARAMS=43;
    public static final int VALUES=44;
    public static final int REEL=45;
    public static final int CHAINE=46;
    public static final int WS=47;

    // delegates
    // delegators


        public LogoParser(TokenStream input) {
            this(input, new RecognizerSharedState());
        }
        public LogoParser(TokenStream input, RecognizerSharedState state) {
            super(input, state);
             
        }
        
    protected TreeAdaptor adaptor = new CommonTreeAdaptor();

    public void setTreeAdaptor(TreeAdaptor adaptor) {
        this.adaptor = adaptor;
    }
    public TreeAdaptor getTreeAdaptor() {
        return adaptor;
    }

    public String[] getTokenNames() { return LogoParser.tokenNames; }
    public String getGrammarFileName() { return "D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g"; }


      Context context;
      Traceur traceur;
      private Vector<String> noms_parametres;
      private Vector<Double> valeurs_parametres;
      private Procedure tmp;
      boolean valide = true;
      public boolean getValide(){
       return valide;
     }
     
      public double getVar(String name) {
    	  Double value = null;
    	  Stack pile = context.getPile();
    	  HashMap<String,Double> h;
    	  for(int i=pile.size()-1; i>=0; i--){
    	    h = (HashMap<String,Double>)pile.get(i);
    	    value = h.get(name);
    	    if ( value!=null ) {
    	      if(i==pile.size()-1 && value.doubleValue() == -1){
    	        return 0;
    	      }
    	          return value.doubleValue();
    	    }
    	  }
    	  
    	  if(context.getVarProcedure(name))
    	    return 0;
    	  if ( value==null ) {
    	    if(name == "loop")
    	      Log.appendnl("LOOP n'est pas dans un REPETE !!!");
    	    else
    	      Log.appendnl("pas de variable existante : "+name);
    	    valide=false;
    	  }
    	  return 0.0;
      }
        
       public void setVar(String name, double value) {
    	    Double p = new Double(value);
    	    HashMap<String,Double> h = (HashMap<String,Double>)context.peek();
    	    h.put(name, p);
       }
     
     
        public void ajouterValParam(double value){
          Double p = new Double(value);
          valeurs_parametres.add(p);
        }
        
        public void empileNomParam(String value){
          noms_parametres.add(value);
        }
        

        public void ariteProcedure(int nbParamsDeclared, int nbParamsPassed){
          if(nbParamsPassed != nbParamsDeclared){
            valide = false;
          }
        }
        
        public boolean alreadyNomParam(String name){
          boolean bool = false;
          bool = noms_parametres.contains("PARAM_"+name);
          if (bool){
            valide = false;
            return true;
          }else{
            return false;
          }
        }
        
        public void appelProc(String name){
          Procedure p = context.getProcedure(name);
          if(p == null){ 
            valide = false;
          }else{
            ariteProcedure(p.getNbParams(),valeurs_parametres.size());
          }
          valeurs_parametres.clear();
          //p.afficher();
          Log.appendnl("appel procedure : "+name);
        }
        
        public void addProcedure(String name){
          Procedure p = new Procedure(name);
          tmp = p;
          context.addProcedure(p);
          noms_parametres.clear();
        }


    public static class expr_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "expr"
    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:163:1: expr : term ( ( PLUS | MINUS ) term )* ;
    public final LogoParser.expr_return expr() throws RecognitionException {
        LogoParser.expr_return retval = new LogoParser.expr_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token PLUS2=null;
        Token MINUS3=null;
        LogoParser.term_return term1 = null;

        LogoParser.term_return term4 = null;


        Object PLUS2_tree=null;
        Object MINUS3_tree=null;

        try {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:163:9: ( term ( ( PLUS | MINUS ) term )* )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:163:11: term ( ( PLUS | MINUS ) term )*
            {
            root_0 = (Object)adaptor.nil();

            pushFollow(FOLLOW_term_in_expr500);
            term1=term();

            state._fsp--;

            adaptor.addChild(root_0, term1.getTree());
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:163:16: ( ( PLUS | MINUS ) term )*
            loop2:
            do {
                int alt2=2;
                int LA2_0 = input.LA(1);

                if ( (LA2_0==PLUS) ) {
                    alt2=1;
                }
                else if ( (LA2_0==MINUS) ) {
                    alt2=1;
                }


                switch (alt2) {
            	case 1 :
            	    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:163:18: ( PLUS | MINUS ) term
            	    {
            	    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:163:18: ( PLUS | MINUS )
            	    int alt1=2;
            	    int LA1_0 = input.LA(1);

            	    if ( (LA1_0==PLUS) ) {
            	        alt1=1;
            	    }
            	    else if ( (LA1_0==MINUS) ) {
            	        alt1=2;
            	    }
            	    else {
            	        NoViableAltException nvae =
            	            new NoViableAltException("", 1, 0, input);

            	        throw nvae;
            	    }
            	    switch (alt1) {
            	        case 1 :
            	            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:163:20: PLUS
            	            {
            	            PLUS2=(Token)match(input,PLUS,FOLLOW_PLUS_in_expr506); 
            	            PLUS2_tree = (Object)adaptor.create(PLUS2);
            	            root_0 = (Object)adaptor.becomeRoot(PLUS2_tree, root_0);


            	            }
            	            break;
            	        case 2 :
            	            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:163:28: MINUS
            	            {
            	            MINUS3=(Token)match(input,MINUS,FOLLOW_MINUS_in_expr511); 
            	            MINUS3_tree = (Object)adaptor.create(MINUS3);
            	            root_0 = (Object)adaptor.becomeRoot(MINUS3_tree, root_0);


            	            }
            	            break;

            	    }

            	    pushFollow(FOLLOW_term_in_expr517);
            	    term4=term();

            	    state._fsp--;

            	    adaptor.addChild(root_0, term4.getTree());

            	    }
            	    break;

            	default :
            	    break loop2;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "expr"

    public static class term_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "term"
    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:164:1: term : ( ( term2 ) ( ( MULT | DIV ) term2 )* ) ;
    public final LogoParser.term_return term() throws RecognitionException {
        LogoParser.term_return retval = new LogoParser.term_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token MULT6=null;
        Token DIV7=null;
        LogoParser.term2_return term25 = null;

        LogoParser.term2_return term28 = null;


        Object MULT6_tree=null;
        Object DIV7_tree=null;

        try {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:164:9: ( ( ( term2 ) ( ( MULT | DIV ) term2 )* ) )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:164:11: ( ( term2 ) ( ( MULT | DIV ) term2 )* )
            {
            root_0 = (Object)adaptor.nil();

            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:164:11: ( ( term2 ) ( ( MULT | DIV ) term2 )* )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:164:12: ( term2 ) ( ( MULT | DIV ) term2 )*
            {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:164:12: ( term2 )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:164:13: term2
            {
            pushFollow(FOLLOW_term2_in_term533);
            term25=term2();

            state._fsp--;

            adaptor.addChild(root_0, term25.getTree());

            }

            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:164:21: ( ( MULT | DIV ) term2 )*
            loop4:
            do {
                int alt4=2;
                int LA4_0 = input.LA(1);

                if ( (LA4_0==MULT) ) {
                    alt4=1;
                }
                else if ( (LA4_0==DIV) ) {
                    alt4=1;
                }


                switch (alt4) {
            	case 1 :
            	    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:164:22: ( MULT | DIV ) term2
            	    {
            	    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:164:22: ( MULT | DIV )
            	    int alt3=2;
            	    int LA3_0 = input.LA(1);

            	    if ( (LA3_0==MULT) ) {
            	        alt3=1;
            	    }
            	    else if ( (LA3_0==DIV) ) {
            	        alt3=2;
            	    }
            	    else {
            	        NoViableAltException nvae =
            	            new NoViableAltException("", 3, 0, input);

            	        throw nvae;
            	    }
            	    switch (alt3) {
            	        case 1 :
            	            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:164:24: MULT
            	            {
            	            MULT6=(Token)match(input,MULT,FOLLOW_MULT_in_term540); 
            	            MULT6_tree = (Object)adaptor.create(MULT6);
            	            root_0 = (Object)adaptor.becomeRoot(MULT6_tree, root_0);


            	            }
            	            break;
            	        case 2 :
            	            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:164:32: DIV
            	            {
            	            DIV7=(Token)match(input,DIV,FOLLOW_DIV_in_term545); 
            	            DIV7_tree = (Object)adaptor.create(DIV7);
            	            root_0 = (Object)adaptor.becomeRoot(DIV7_tree, root_0);


            	            }
            	            break;

            	    }

            	    pushFollow(FOLLOW_term2_in_term550);
            	    term28=term2();

            	    state._fsp--;

            	    adaptor.addChild(root_0, term28.getTree());

            	    }
            	    break;

            	default :
            	    break loop4;
                }
            } while (true);


            }


            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "term"

    public static class term2_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "term2"
    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:165:1: term2 : ( REEL | hasardexpr | math | ( '(' expr ')' ) | LOOP | CAP | ( POINTS CHAINE ) );
    public final LogoParser.term2_return term2() throws RecognitionException {
        LogoParser.term2_return retval = new LogoParser.term2_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token REEL9=null;
        Token char_literal12=null;
        Token char_literal14=null;
        Token LOOP15=null;
        Token CAP16=null;
        Token POINTS17=null;
        Token CHAINE18=null;
        LogoParser.hasardexpr_return hasardexpr10 = null;

        LogoParser.math_return math11 = null;

        LogoParser.expr_return expr13 = null;


        Object REEL9_tree=null;
        Object char_literal12_tree=null;
        Object char_literal14_tree=null;
        Object LOOP15_tree=null;
        Object CAP16_tree=null;
        Object POINTS17_tree=null;
        Object CHAINE18_tree=null;

        try {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:165:10: ( REEL | hasardexpr | math | ( '(' expr ')' ) | LOOP | CAP | ( POINTS CHAINE ) )
            int alt5=7;
            switch ( input.LA(1) ) {
            case REEL:
                {
                alt5=1;
                }
                break;
            case HASARD:
                {
                alt5=2;
                }
                break;
            case SIN:
                {
                alt5=3;
                }
                break;
            case 48:
                {
                alt5=4;
                }
                break;
            case LOOP:
                {
                alt5=5;
                }
                break;
            case CAP:
                {
                alt5=6;
                }
                break;
            case POINTS:
                {
                alt5=7;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 5, 0, input);

                throw nvae;
            }

            switch (alt5) {
                case 1 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:165:12: REEL
                    {
                    root_0 = (Object)adaptor.nil();

                    REEL9=(Token)match(input,REEL,FOLLOW_REEL_in_term2565); 
                    REEL9_tree = (Object)adaptor.create(REEL9);
                    adaptor.addChild(root_0, REEL9_tree);


                    }
                    break;
                case 2 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:165:18: hasardexpr
                    {
                    root_0 = (Object)adaptor.nil();

                    pushFollow(FOLLOW_hasardexpr_in_term2568);
                    hasardexpr10=hasardexpr();

                    state._fsp--;

                    adaptor.addChild(root_0, hasardexpr10.getTree());

                    }
                    break;
                case 3 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:165:31: math
                    {
                    root_0 = (Object)adaptor.nil();

                    pushFollow(FOLLOW_math_in_term2572);
                    math11=math();

                    state._fsp--;

                    adaptor.addChild(root_0, math11.getTree());

                    }
                    break;
                case 4 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:165:38: ( '(' expr ')' )
                    {
                    root_0 = (Object)adaptor.nil();

                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:165:38: ( '(' expr ')' )
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:165:39: '(' expr ')'
                    {
                    char_literal12=(Token)match(input,48,FOLLOW_48_in_term2577); 
                    pushFollow(FOLLOW_expr_in_term2579);
                    expr13=expr();

                    state._fsp--;

                    adaptor.addChild(root_0, expr13.getTree());
                    char_literal14=(Token)match(input,49,FOLLOW_49_in_term2580); 

                    }


                    }
                    break;
                case 5 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:165:55: LOOP
                    {
                    root_0 = (Object)adaptor.nil();

                    LOOP15=(Token)match(input,LOOP,FOLLOW_LOOP_in_term2586); 
                    LOOP15_tree = (Object)adaptor.create(LOOP15);
                    adaptor.addChild(root_0, LOOP15_tree);

                     setVar("LOOP",0);

                    }
                    break;
                case 6 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:165:82: CAP
                    {
                    root_0 = (Object)adaptor.nil();

                    CAP16=(Token)match(input,CAP,FOLLOW_CAP_in_term2591); 
                    CAP16_tree = (Object)adaptor.create(CAP16);
                    adaptor.addChild(root_0, CAP16_tree);


                    }
                    break;
                case 7 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:165:88: ( POINTS CHAINE )
                    {
                    root_0 = (Object)adaptor.nil();

                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:165:88: ( POINTS CHAINE )
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:165:89: POINTS CHAINE
                    {
                    POINTS17=(Token)match(input,POINTS,FOLLOW_POINTS_in_term2596); 
                    CHAINE18=(Token)match(input,CHAINE,FOLLOW_CHAINE_in_term2599); 
                    CHAINE18_tree = (Object)adaptor.create(CHAINE18);
                    adaptor.addChild(root_0, CHAINE18_tree);

                     if(CHAINE18.getText() != "LOOP") getVar(CHAINE18.getText()); 

                    }


                    }
                    break;

            }
            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "term2"

    public static class programme_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "programme"
    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:167:1: programme[Context con] : liste_instructions -> ^( PROGRAMME liste_instructions ) ;
    public final LogoParser.programme_return programme(Context con) throws RecognitionException {
        LogoParser.programme_return retval = new LogoParser.programme_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        LogoParser.liste_instructions_return liste_instructions19 = null;


        RewriteRuleSubtreeStream stream_liste_instructions=new RewriteRuleSubtreeStream(adaptor,"rule liste_instructions");

          context = con;
          context.init();
          noms_parametres = new Vector<String>();
          valeurs_parametres = new Vector<Double>();

        try {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:174:1: ( liste_instructions -> ^( PROGRAMME liste_instructions ) )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:175:3: liste_instructions
            {
            pushFollow(FOLLOW_liste_instructions_in_programme618);
            liste_instructions19=liste_instructions();

            state._fsp--;

            stream_liste_instructions.add(liste_instructions19.getTree());


            // AST REWRITE
            // elements: liste_instructions
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (Object)adaptor.nil();
            // 175:22: -> ^( PROGRAMME liste_instructions )
            {
                // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:175:25: ^( PROGRAMME liste_instructions )
                {
                Object root_1 = (Object)adaptor.nil();
                root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(PROGRAMME, "PROGRAMME"), root_1);

                adaptor.addChild(root_1, stream_liste_instructions.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "programme"

    public static class liste_instructions_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "liste_instructions"
    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:178:1: liste_instructions : ( instruction )+ ;
    public final LogoParser.liste_instructions_return liste_instructions() throws RecognitionException {
        LogoParser.liste_instructions_return retval = new LogoParser.liste_instructions_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        LogoParser.instruction_return instruction20 = null;



        try {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:178:20: ( ( instruction )+ )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:178:22: ( instruction )+
            {
            root_0 = (Object)adaptor.nil();

            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:178:22: ( instruction )+
            int cnt6=0;
            loop6:
            do {
                int alt6=2;
                int LA6_0 = input.LA(1);

                if ( ((LA6_0>=AV && LA6_0<=FCAP)||(LA6_0>=VE && LA6_0<=FCC)||LA6_0==REPETE||(LA6_0>=TANTQUE && LA6_0<=POUR)||(LA6_0>=RETURN && LA6_0<=IF)||(LA6_0>=DONNE && LA6_0<=LOCALE)||LA6_0==CHAINE) ) {
                    alt6=1;
                }


                switch (alt6) {
            	case 1 :
            	    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:178:23: instruction
            	    {
            	    pushFollow(FOLLOW_instruction_in_liste_instructions636);
            	    instruction20=instruction();

            	    state._fsp--;

            	    adaptor.addChild(root_0, instruction20.getTree());

            	    }
            	    break;

            	default :
            	    if ( cnt6 >= 1 ) break loop6;
                        EarlyExitException eee =
                            new EarlyExitException(6, input);
                        throw eee;
                }
                cnt6++;
            } while (true);


            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "liste_instructions"

    public static class instruction_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "instruction"
    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:180:1: instruction : ( ( ( LC | BC | VE | MT | CT ) | ( AV | TD | TG | REC | FCAP | FCC ) expr ) | ( FPOS '[' expr expr ']' ) | ( TANTQUE boolexpr liste ) | ( REPETE expr liste ) | ( IF boolexpr liste ( liste )? ) | ( LOCALE GUILLEMETS CHAINE ) | ( DONNE GUILLEMETS CHAINE a= expr ) | ( POUR CHAINE liste_p blockPour ) | appel_procedure | ( RETURN expr ) );
    public final LogoParser.instruction_return instruction() throws RecognitionException {
        LogoParser.instruction_return retval = new LogoParser.instruction_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token LC21=null;
        Token BC22=null;
        Token VE23=null;
        Token MT24=null;
        Token CT25=null;
        Token AV26=null;
        Token TD27=null;
        Token TG28=null;
        Token REC29=null;
        Token FCAP30=null;
        Token FCC31=null;
        Token FPOS33=null;
        Token char_literal34=null;
        Token char_literal37=null;
        Token TANTQUE38=null;
        Token REPETE41=null;
        Token IF44=null;
        Token LOCALE48=null;
        Token GUILLEMETS49=null;
        Token CHAINE50=null;
        Token DONNE51=null;
        Token GUILLEMETS52=null;
        Token CHAINE53=null;
        Token POUR54=null;
        Token CHAINE55=null;
        Token RETURN59=null;
        LogoParser.expr_return a = null;

        LogoParser.expr_return expr32 = null;

        LogoParser.expr_return expr35 = null;

        LogoParser.expr_return expr36 = null;

        LogoParser.boolexpr_return boolexpr39 = null;

        LogoParser.liste_return liste40 = null;

        LogoParser.expr_return expr42 = null;

        LogoParser.liste_return liste43 = null;

        LogoParser.boolexpr_return boolexpr45 = null;

        LogoParser.liste_return liste46 = null;

        LogoParser.liste_return liste47 = null;

        LogoParser.liste_p_return liste_p56 = null;

        LogoParser.blockPour_return blockPour57 = null;

        LogoParser.appel_procedure_return appel_procedure58 = null;

        LogoParser.expr_return expr60 = null;


        Object LC21_tree=null;
        Object BC22_tree=null;
        Object VE23_tree=null;
        Object MT24_tree=null;
        Object CT25_tree=null;
        Object AV26_tree=null;
        Object TD27_tree=null;
        Object TG28_tree=null;
        Object REC29_tree=null;
        Object FCAP30_tree=null;
        Object FCC31_tree=null;
        Object FPOS33_tree=null;
        Object char_literal34_tree=null;
        Object char_literal37_tree=null;
        Object TANTQUE38_tree=null;
        Object REPETE41_tree=null;
        Object IF44_tree=null;
        Object LOCALE48_tree=null;
        Object GUILLEMETS49_tree=null;
        Object CHAINE50_tree=null;
        Object DONNE51_tree=null;
        Object GUILLEMETS52_tree=null;
        Object CHAINE53_tree=null;
        Object POUR54_tree=null;
        Object CHAINE55_tree=null;
        Object RETURN59_tree=null;

        try {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:180:13: ( ( ( LC | BC | VE | MT | CT ) | ( AV | TD | TG | REC | FCAP | FCC ) expr ) | ( FPOS '[' expr expr ']' ) | ( TANTQUE boolexpr liste ) | ( REPETE expr liste ) | ( IF boolexpr liste ( liste )? ) | ( LOCALE GUILLEMETS CHAINE ) | ( DONNE GUILLEMETS CHAINE a= expr ) | ( POUR CHAINE liste_p blockPour ) | appel_procedure | ( RETURN expr ) )
            int alt11=10;
            switch ( input.LA(1) ) {
            case AV:
            case TD:
            case TG:
            case LC:
            case BC:
            case REC:
            case FCAP:
            case VE:
            case MT:
            case CT:
            case FCC:
                {
                alt11=1;
                }
                break;
            case FPOS:
                {
                alt11=2;
                }
                break;
            case TANTQUE:
                {
                alt11=3;
                }
                break;
            case REPETE:
                {
                alt11=4;
                }
                break;
            case IF:
                {
                alt11=5;
                }
                break;
            case LOCALE:
                {
                alt11=6;
                }
                break;
            case DONNE:
                {
                alt11=7;
                }
                break;
            case POUR:
                {
                alt11=8;
                }
                break;
            case CHAINE:
                {
                alt11=9;
                }
                break;
            case RETURN:
                {
                alt11=10;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 11, 0, input);

                throw nvae;
            }

            switch (alt11) {
                case 1 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:181:1: ( ( LC | BC | VE | MT | CT ) | ( AV | TD | TG | REC | FCAP | FCC ) expr )
                    {
                    root_0 = (Object)adaptor.nil();

                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:181:1: ( ( LC | BC | VE | MT | CT ) | ( AV | TD | TG | REC | FCAP | FCC ) expr )
                    int alt9=2;
                    int LA9_0 = input.LA(1);

                    if ( ((LA9_0>=LC && LA9_0<=BC)||(LA9_0>=VE && LA9_0<=CT)) ) {
                        alt9=1;
                    }
                    else if ( ((LA9_0>=AV && LA9_0<=TG)||LA9_0==REC||LA9_0==FCAP||LA9_0==FCC) ) {
                        alt9=2;
                    }
                    else {
                        NoViableAltException nvae =
                            new NoViableAltException("", 9, 0, input);

                        throw nvae;
                    }
                    switch (alt9) {
                        case 1 :
                            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:181:2: ( LC | BC | VE | MT | CT )
                            {
                            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:181:2: ( LC | BC | VE | MT | CT )
                            int alt7=5;
                            switch ( input.LA(1) ) {
                            case LC:
                                {
                                alt7=1;
                                }
                                break;
                            case BC:
                                {
                                alt7=2;
                                }
                                break;
                            case VE:
                                {
                                alt7=3;
                                }
                                break;
                            case MT:
                                {
                                alt7=4;
                                }
                                break;
                            case CT:
                                {
                                alt7=5;
                                }
                                break;
                            default:
                                NoViableAltException nvae =
                                    new NoViableAltException("", 7, 0, input);

                                throw nvae;
                            }

                            switch (alt7) {
                                case 1 :
                                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:181:3: LC
                                    {
                                    LC21=(Token)match(input,LC,FOLLOW_LC_in_instruction649); 
                                    LC21_tree = (Object)adaptor.create(LC21);
                                    root_0 = (Object)adaptor.becomeRoot(LC21_tree, root_0);


                                    }
                                    break;
                                case 2 :
                                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:181:9: BC
                                    {
                                    BC22=(Token)match(input,BC,FOLLOW_BC_in_instruction654); 
                                    BC22_tree = (Object)adaptor.create(BC22);
                                    root_0 = (Object)adaptor.becomeRoot(BC22_tree, root_0);


                                    }
                                    break;
                                case 3 :
                                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:181:15: VE
                                    {
                                    VE23=(Token)match(input,VE,FOLLOW_VE_in_instruction659); 
                                    VE23_tree = (Object)adaptor.create(VE23);
                                    root_0 = (Object)adaptor.becomeRoot(VE23_tree, root_0);


                                    }
                                    break;
                                case 4 :
                                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:181:21: MT
                                    {
                                    MT24=(Token)match(input,MT,FOLLOW_MT_in_instruction664); 
                                    MT24_tree = (Object)adaptor.create(MT24);
                                    root_0 = (Object)adaptor.becomeRoot(MT24_tree, root_0);


                                    }
                                    break;
                                case 5 :
                                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:181:27: CT
                                    {
                                    CT25=(Token)match(input,CT,FOLLOW_CT_in_instruction669); 
                                    CT25_tree = (Object)adaptor.create(CT25);
                                    root_0 = (Object)adaptor.becomeRoot(CT25_tree, root_0);


                                    }
                                    break;

                            }


                            }
                            break;
                        case 2 :
                            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:182:1: ( AV | TD | TG | REC | FCAP | FCC ) expr
                            {
                            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:182:1: ( AV | TD | TG | REC | FCAP | FCC )
                            int alt8=6;
                            switch ( input.LA(1) ) {
                            case AV:
                                {
                                alt8=1;
                                }
                                break;
                            case TD:
                                {
                                alt8=2;
                                }
                                break;
                            case TG:
                                {
                                alt8=3;
                                }
                                break;
                            case REC:
                                {
                                alt8=4;
                                }
                                break;
                            case FCAP:
                                {
                                alt8=5;
                                }
                                break;
                            case FCC:
                                {
                                alt8=6;
                                }
                                break;
                            default:
                                NoViableAltException nvae =
                                    new NoViableAltException("", 8, 0, input);

                                throw nvae;
                            }

                            switch (alt8) {
                                case 1 :
                                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:182:3: AV
                                    {
                                    AV26=(Token)match(input,AV,FOLLOW_AV_in_instruction678); 
                                    AV26_tree = (Object)adaptor.create(AV26);
                                    root_0 = (Object)adaptor.becomeRoot(AV26_tree, root_0);


                                    }
                                    break;
                                case 2 :
                                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:182:9: TD
                                    {
                                    TD27=(Token)match(input,TD,FOLLOW_TD_in_instruction683); 
                                    TD27_tree = (Object)adaptor.create(TD27);
                                    root_0 = (Object)adaptor.becomeRoot(TD27_tree, root_0);


                                    }
                                    break;
                                case 3 :
                                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:182:15: TG
                                    {
                                    TG28=(Token)match(input,TG,FOLLOW_TG_in_instruction688); 
                                    TG28_tree = (Object)adaptor.create(TG28);
                                    root_0 = (Object)adaptor.becomeRoot(TG28_tree, root_0);


                                    }
                                    break;
                                case 4 :
                                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:182:21: REC
                                    {
                                    REC29=(Token)match(input,REC,FOLLOW_REC_in_instruction693); 
                                    REC29_tree = (Object)adaptor.create(REC29);
                                    root_0 = (Object)adaptor.becomeRoot(REC29_tree, root_0);


                                    }
                                    break;
                                case 5 :
                                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:182:28: FCAP
                                    {
                                    FCAP30=(Token)match(input,FCAP,FOLLOW_FCAP_in_instruction698); 
                                    FCAP30_tree = (Object)adaptor.create(FCAP30);
                                    root_0 = (Object)adaptor.becomeRoot(FCAP30_tree, root_0);


                                    }
                                    break;
                                case 6 :
                                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:182:36: FCC
                                    {
                                    FCC31=(Token)match(input,FCC,FOLLOW_FCC_in_instruction703); 
                                    FCC31_tree = (Object)adaptor.create(FCC31);
                                    root_0 = (Object)adaptor.becomeRoot(FCC31_tree, root_0);


                                    }
                                    break;

                            }

                            pushFollow(FOLLOW_expr_in_instruction707);
                            expr32=expr();

                            state._fsp--;

                            adaptor.addChild(root_0, expr32.getTree());

                            }
                            break;

                    }


                    }
                    break;
                case 2 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:183:1: ( FPOS '[' expr expr ']' )
                    {
                    root_0 = (Object)adaptor.nil();

                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:183:1: ( FPOS '[' expr expr ']' )
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:183:2: FPOS '[' expr expr ']'
                    {
                    FPOS33=(Token)match(input,FPOS,FOLLOW_FPOS_in_instruction713); 
                    FPOS33_tree = (Object)adaptor.create(FPOS33);
                    root_0 = (Object)adaptor.becomeRoot(FPOS33_tree, root_0);

                    char_literal34=(Token)match(input,50,FOLLOW_50_in_instruction716); 
                    pushFollow(FOLLOW_expr_in_instruction719);
                    expr35=expr();

                    state._fsp--;

                    adaptor.addChild(root_0, expr35.getTree());
                    pushFollow(FOLLOW_expr_in_instruction721);
                    expr36=expr();

                    state._fsp--;

                    adaptor.addChild(root_0, expr36.getTree());
                    char_literal37=(Token)match(input,51,FOLLOW_51_in_instruction723); 

                    }


                    }
                    break;
                case 3 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:184:1: ( TANTQUE boolexpr liste )
                    {
                    root_0 = (Object)adaptor.nil();

                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:184:1: ( TANTQUE boolexpr liste )
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:184:2: TANTQUE boolexpr liste
                    {
                    TANTQUE38=(Token)match(input,TANTQUE,FOLLOW_TANTQUE_in_instruction730); 
                    TANTQUE38_tree = (Object)adaptor.create(TANTQUE38);
                    root_0 = (Object)adaptor.becomeRoot(TANTQUE38_tree, root_0);

                    pushFollow(FOLLOW_boolexpr_in_instruction733);
                    boolexpr39=boolexpr();

                    state._fsp--;

                    adaptor.addChild(root_0, boolexpr39.getTree());
                    pushFollow(FOLLOW_liste_in_instruction735);
                    liste40=liste();

                    state._fsp--;

                    adaptor.addChild(root_0, liste40.getTree());

                    }


                    }
                    break;
                case 4 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:185:1: ( REPETE expr liste )
                    {
                    root_0 = (Object)adaptor.nil();

                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:185:1: ( REPETE expr liste )
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:185:2: REPETE expr liste
                    {
                    REPETE41=(Token)match(input,REPETE,FOLLOW_REPETE_in_instruction741); 
                    REPETE41_tree = (Object)adaptor.create(REPETE41);
                    root_0 = (Object)adaptor.becomeRoot(REPETE41_tree, root_0);

                    pushFollow(FOLLOW_expr_in_instruction744);
                    expr42=expr();

                    state._fsp--;

                    adaptor.addChild(root_0, expr42.getTree());
                    pushFollow(FOLLOW_liste_in_instruction746);
                    liste43=liste();

                    state._fsp--;

                    adaptor.addChild(root_0, liste43.getTree());

                    }


                    }
                    break;
                case 5 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:186:1: ( IF boolexpr liste ( liste )? )
                    {
                    root_0 = (Object)adaptor.nil();

                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:186:1: ( IF boolexpr liste ( liste )? )
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:186:2: IF boolexpr liste ( liste )?
                    {
                    IF44=(Token)match(input,IF,FOLLOW_IF_in_instruction753); 
                    IF44_tree = (Object)adaptor.create(IF44);
                    root_0 = (Object)adaptor.becomeRoot(IF44_tree, root_0);

                    pushFollow(FOLLOW_boolexpr_in_instruction756);
                    boolexpr45=boolexpr();

                    state._fsp--;

                    adaptor.addChild(root_0, boolexpr45.getTree());
                    pushFollow(FOLLOW_liste_in_instruction758);
                    liste46=liste();

                    state._fsp--;

                    adaptor.addChild(root_0, liste46.getTree());
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:186:21: ( liste )?
                    int alt10=2;
                    int LA10_0 = input.LA(1);

                    if ( (LA10_0==50) ) {
                        alt10=1;
                    }
                    switch (alt10) {
                        case 1 :
                            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:186:21: liste
                            {
                            pushFollow(FOLLOW_liste_in_instruction760);
                            liste47=liste();

                            state._fsp--;

                            adaptor.addChild(root_0, liste47.getTree());

                            }
                            break;

                    }


                    }


                    }
                    break;
                case 6 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:187:1: ( LOCALE GUILLEMETS CHAINE )
                    {
                    root_0 = (Object)adaptor.nil();

                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:187:1: ( LOCALE GUILLEMETS CHAINE )
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:187:2: LOCALE GUILLEMETS CHAINE
                    {
                    LOCALE48=(Token)match(input,LOCALE,FOLLOW_LOCALE_in_instruction766); 
                    LOCALE48_tree = (Object)adaptor.create(LOCALE48);
                    root_0 = (Object)adaptor.becomeRoot(LOCALE48_tree, root_0);

                    GUILLEMETS49=(Token)match(input,GUILLEMETS,FOLLOW_GUILLEMETS_in_instruction769); 
                    CHAINE50=(Token)match(input,CHAINE,FOLLOW_CHAINE_in_instruction772); 
                    CHAINE50_tree = (Object)adaptor.create(CHAINE50);
                    adaptor.addChild(root_0, CHAINE50_tree);


                    }

                     if(CHAINE50.getText() != "LOOP" && CHAINE50.getText() != "RENDS" && !alreadyNomParam(CHAINE50.getText())) setVar(CHAINE50.getText(),-1); 

                    }
                    break;
                case 7 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:188:1: ( DONNE GUILLEMETS CHAINE a= expr )
                    {
                    root_0 = (Object)adaptor.nil();

                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:188:1: ( DONNE GUILLEMETS CHAINE a= expr )
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:188:2: DONNE GUILLEMETS CHAINE a= expr
                    {
                    DONNE51=(Token)match(input,DONNE,FOLLOW_DONNE_in_instruction780); 
                    DONNE51_tree = (Object)adaptor.create(DONNE51);
                    root_0 = (Object)adaptor.becomeRoot(DONNE51_tree, root_0);

                    GUILLEMETS52=(Token)match(input,GUILLEMETS,FOLLOW_GUILLEMETS_in_instruction783); 
                    CHAINE53=(Token)match(input,CHAINE,FOLLOW_CHAINE_in_instruction786); 
                    CHAINE53_tree = (Object)adaptor.create(CHAINE53);
                    adaptor.addChild(root_0, CHAINE53_tree);

                    pushFollow(FOLLOW_expr_in_instruction790);
                    a=expr();

                    state._fsp--;

                    adaptor.addChild(root_0, a.getTree());

                    }

                     if(CHAINE53.getText() != "LOOP" && CHAINE53.getText() != "RENDS") setVar(CHAINE53.getText(),0); 

                    }
                    break;
                case 8 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:189:1: ( POUR CHAINE liste_p blockPour )
                    {
                    root_0 = (Object)adaptor.nil();

                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:189:1: ( POUR CHAINE liste_p blockPour )
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:189:2: POUR CHAINE liste_p blockPour
                    {
                    POUR54=(Token)match(input,POUR,FOLLOW_POUR_in_instruction798); 
                    POUR54_tree = (Object)adaptor.create(POUR54);
                    root_0 = (Object)adaptor.becomeRoot(POUR54_tree, root_0);

                    CHAINE55=(Token)match(input,CHAINE,FOLLOW_CHAINE_in_instruction801); 
                    CHAINE55_tree = (Object)adaptor.create(CHAINE55);
                    adaptor.addChild(root_0, CHAINE55_tree);

                     addProcedure(CHAINE55.getText()); 
                    pushFollow(FOLLOW_liste_p_in_instruction805);
                    liste_p56=liste_p();

                    state._fsp--;

                    adaptor.addChild(root_0, liste_p56.getTree());
                    pushFollow(FOLLOW_blockPour_in_instruction807);
                    blockPour57=blockPour();

                    state._fsp--;

                    adaptor.addChild(root_0, blockPour57.getTree());

                    }


                    }
                    break;
                case 9 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:190:1: appel_procedure
                    {
                    root_0 = (Object)adaptor.nil();

                    pushFollow(FOLLOW_appel_procedure_in_instruction812);
                    appel_procedure58=appel_procedure();

                    state._fsp--;

                    adaptor.addChild(root_0, appel_procedure58.getTree());

                    }
                    break;
                case 10 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:191:1: ( RETURN expr )
                    {
                    root_0 = (Object)adaptor.nil();

                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:191:1: ( RETURN expr )
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:191:2: RETURN expr
                    {
                    RETURN59=(Token)match(input,RETURN,FOLLOW_RETURN_in_instruction816); 
                    RETURN59_tree = (Object)adaptor.create(RETURN59);
                    root_0 = (Object)adaptor.becomeRoot(RETURN59_tree, root_0);

                    pushFollow(FOLLOW_expr_in_instruction819);
                    expr60=expr();

                    state._fsp--;

                    adaptor.addChild(root_0, expr60.getTree());

                    }


                    }
                    break;

            }
            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "instruction"

    public static class liste_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "liste"
    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:194:1: liste : '[' liste_instructions ']' ;
    public final LogoParser.liste_return liste() throws RecognitionException {
        LogoParser.liste_return retval = new LogoParser.liste_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token char_literal61=null;
        Token char_literal63=null;
        LogoParser.liste_instructions_return liste_instructions62 = null;


        Object char_literal61_tree=null;
        Object char_literal63_tree=null;


          HashMap<String,Double> h = new HashMap<String,Double>();
          context.push(h);

        try {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:201:3: ( '[' liste_instructions ']' )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:201:5: '[' liste_instructions ']'
            {
            root_0 = (Object)adaptor.nil();

            char_literal61=(Token)match(input,50,FOLLOW_50_in_liste837); 
            char_literal61_tree = (Object)adaptor.create(char_literal61);
            root_0 = (Object)adaptor.becomeRoot(char_literal61_tree, root_0);

            pushFollow(FOLLOW_liste_instructions_in_liste840);
            liste_instructions62=liste_instructions();

            state._fsp--;

            adaptor.addChild(root_0, liste_instructions62.getTree());
            char_literal63=(Token)match(input,51,FOLLOW_51_in_liste842); 

            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);


              context.pop();

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "liste"

    public static class blockPour_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "blockPour"
    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:204:1: blockPour : liste_instructions 'FIN' -> ^( INSTR liste_instructions ) ;
    public final LogoParser.blockPour_return blockPour() throws RecognitionException {
        LogoParser.blockPour_return retval = new LogoParser.blockPour_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token string_literal65=null;
        LogoParser.liste_instructions_return liste_instructions64 = null;


        Object string_literal65_tree=null;
        RewriteRuleTokenStream stream_FIN=new RewriteRuleTokenStream(adaptor,"token FIN");
        RewriteRuleSubtreeStream stream_liste_instructions=new RewriteRuleSubtreeStream(adaptor,"rule liste_instructions");

          HashMap<String,Double> h = new HashMap<String,Double>();
          context.push(h);

        try {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:212:1: ( liste_instructions 'FIN' -> ^( INSTR liste_instructions ) )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:212:3: liste_instructions 'FIN'
            {
            pushFollow(FOLLOW_liste_instructions_in_blockPour860);
            liste_instructions64=liste_instructions();

            state._fsp--;

            stream_liste_instructions.add(liste_instructions64.getTree());
            string_literal65=(Token)match(input,FIN,FOLLOW_FIN_in_blockPour862);  
            stream_FIN.add(string_literal65);



            // AST REWRITE
            // elements: liste_instructions
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (Object)adaptor.nil();
            // 212:28: -> ^( INSTR liste_instructions )
            {
                // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:212:31: ^( INSTR liste_instructions )
                {
                Object root_1 = (Object)adaptor.nil();
                root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(INSTR, "INSTR"), root_1);

                adaptor.addChild(root_1, stream_liste_instructions.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);


              context.pop();

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "blockPour"

    public static class hasardexpr_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "hasardexpr"
    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:216:1: hasardexpr : HASARD expr ;
    public final LogoParser.hasardexpr_return hasardexpr() throws RecognitionException {
        LogoParser.hasardexpr_return retval = new LogoParser.hasardexpr_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token HASARD66=null;
        LogoParser.expr_return expr67 = null;


        Object HASARD66_tree=null;

        try {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:216:12: ( HASARD expr )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:216:14: HASARD expr
            {
            root_0 = (Object)adaptor.nil();

            HASARD66=(Token)match(input,HASARD,FOLLOW_HASARD_in_hasardexpr880); 
            HASARD66_tree = (Object)adaptor.create(HASARD66);
            root_0 = (Object)adaptor.becomeRoot(HASARD66_tree, root_0);

            pushFollow(FOLLOW_expr_in_hasardexpr883);
            expr67=expr();

            state._fsp--;

            adaptor.addChild(root_0, expr67.getTree());

            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "hasardexpr"

    public static class math_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "math"
    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:218:1: math : SIN expr ;
    public final LogoParser.math_return math() throws RecognitionException {
        LogoParser.math_return retval = new LogoParser.math_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token SIN68=null;
        LogoParser.expr_return expr69 = null;


        Object SIN68_tree=null;

        try {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:218:6: ( SIN expr )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:218:8: SIN expr
            {
            root_0 = (Object)adaptor.nil();

            SIN68=(Token)match(input,SIN,FOLLOW_SIN_in_math891); 
            SIN68_tree = (Object)adaptor.create(SIN68);
            root_0 = (Object)adaptor.becomeRoot(SIN68_tree, root_0);

            pushFollow(FOLLOW_expr_in_math894);
            expr69=expr();

            state._fsp--;

            adaptor.addChild(root_0, expr69.getTree());

            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "math"

    public static class boolexpr_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "boolexpr"
    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:220:1: boolexpr : expr ( ( EGAL | INF | SUP | DIFF | INFEQ | SUPEQ ) expr ) ;
    public final LogoParser.boolexpr_return boolexpr() throws RecognitionException {
        LogoParser.boolexpr_return retval = new LogoParser.boolexpr_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token EGAL71=null;
        Token INF72=null;
        Token SUP73=null;
        Token DIFF74=null;
        Token INFEQ75=null;
        Token SUPEQ76=null;
        LogoParser.expr_return expr70 = null;

        LogoParser.expr_return expr77 = null;


        Object EGAL71_tree=null;
        Object INF72_tree=null;
        Object SUP73_tree=null;
        Object DIFF74_tree=null;
        Object INFEQ75_tree=null;
        Object SUPEQ76_tree=null;

        try {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:220:10: ( expr ( ( EGAL | INF | SUP | DIFF | INFEQ | SUPEQ ) expr ) )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:220:12: expr ( ( EGAL | INF | SUP | DIFF | INFEQ | SUPEQ ) expr )
            {
            root_0 = (Object)adaptor.nil();

            pushFollow(FOLLOW_expr_in_boolexpr903);
            expr70=expr();

            state._fsp--;

            adaptor.addChild(root_0, expr70.getTree());
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:220:17: ( ( EGAL | INF | SUP | DIFF | INFEQ | SUPEQ ) expr )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:220:18: ( EGAL | INF | SUP | DIFF | INFEQ | SUPEQ ) expr
            {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:220:18: ( EGAL | INF | SUP | DIFF | INFEQ | SUPEQ )
            int alt12=6;
            switch ( input.LA(1) ) {
            case EGAL:
                {
                alt12=1;
                }
                break;
            case INF:
                {
                alt12=2;
                }
                break;
            case SUP:
                {
                alt12=3;
                }
                break;
            case DIFF:
                {
                alt12=4;
                }
                break;
            case INFEQ:
                {
                alt12=5;
                }
                break;
            case SUPEQ:
                {
                alt12=6;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 12, 0, input);

                throw nvae;
            }

            switch (alt12) {
                case 1 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:220:19: EGAL
                    {
                    EGAL71=(Token)match(input,EGAL,FOLLOW_EGAL_in_boolexpr907); 
                    EGAL71_tree = (Object)adaptor.create(EGAL71);
                    root_0 = (Object)adaptor.becomeRoot(EGAL71_tree, root_0);


                    }
                    break;
                case 2 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:220:27: INF
                    {
                    INF72=(Token)match(input,INF,FOLLOW_INF_in_boolexpr912); 
                    INF72_tree = (Object)adaptor.create(INF72);
                    root_0 = (Object)adaptor.becomeRoot(INF72_tree, root_0);


                    }
                    break;
                case 3 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:220:34: SUP
                    {
                    SUP73=(Token)match(input,SUP,FOLLOW_SUP_in_boolexpr917); 
                    SUP73_tree = (Object)adaptor.create(SUP73);
                    root_0 = (Object)adaptor.becomeRoot(SUP73_tree, root_0);


                    }
                    break;
                case 4 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:220:41: DIFF
                    {
                    DIFF74=(Token)match(input,DIFF,FOLLOW_DIFF_in_boolexpr922); 
                    DIFF74_tree = (Object)adaptor.create(DIFF74);
                    root_0 = (Object)adaptor.becomeRoot(DIFF74_tree, root_0);


                    }
                    break;
                case 5 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:220:49: INFEQ
                    {
                    INFEQ75=(Token)match(input,INFEQ,FOLLOW_INFEQ_in_boolexpr927); 
                    INFEQ75_tree = (Object)adaptor.create(INFEQ75);
                    root_0 = (Object)adaptor.becomeRoot(INFEQ75_tree, root_0);


                    }
                    break;
                case 6 :
                    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:220:57: SUPEQ
                    {
                    SUPEQ76=(Token)match(input,SUPEQ,FOLLOW_SUPEQ_in_boolexpr931); 
                    SUPEQ76_tree = (Object)adaptor.create(SUPEQ76);
                    root_0 = (Object)adaptor.becomeRoot(SUPEQ76_tree, root_0);


                    }
                    break;

            }

            pushFollow(FOLLOW_expr_in_boolexpr935);
            expr77=expr();

            state._fsp--;

            adaptor.addChild(root_0, expr77.getTree());

            }


            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "boolexpr"

    public static class liste_p_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "liste_p"
    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:222:1: liste_p : liste_parametres -> ^( PARAMS ( liste_parametres )? ) ;
    public final LogoParser.liste_p_return liste_p() throws RecognitionException {
        LogoParser.liste_p_return retval = new LogoParser.liste_p_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        LogoParser.liste_parametres_return liste_parametres78 = null;


        RewriteRuleSubtreeStream stream_liste_parametres=new RewriteRuleSubtreeStream(adaptor,"rule liste_parametres");
        try {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:222:9: ( liste_parametres -> ^( PARAMS ( liste_parametres )? ) )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:222:11: liste_parametres
            {
            pushFollow(FOLLOW_liste_parametres_in_liste_p944);
            liste_parametres78=liste_parametres();

            state._fsp--;

            stream_liste_parametres.add(liste_parametres78.getTree());


            // AST REWRITE
            // elements: liste_parametres
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (Object)adaptor.nil();
            // 222:28: -> ^( PARAMS ( liste_parametres )? )
            {
                // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:222:31: ^( PARAMS ( liste_parametres )? )
                {
                Object root_1 = (Object)adaptor.nil();
                root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(PARAMS, "PARAMS"), root_1);

                // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:222:40: ( liste_parametres )?
                if ( stream_liste_parametres.hasNext() ) {
                    adaptor.addChild(root_1, stream_liste_parametres.nextTree());

                }
                stream_liste_parametres.reset();

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "liste_p"

    public static class liste_parametres_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "liste_parametres"
    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:223:1: liste_parametres : ( parametre_fonction )* ;
    public final LogoParser.liste_parametres_return liste_parametres() throws RecognitionException {
        LogoParser.liste_parametres_return retval = new LogoParser.liste_parametres_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        LogoParser.parametre_fonction_return parametre_fonction79 = null;



        try {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:223:18: ( ( parametre_fonction )* )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:223:20: ( parametre_fonction )*
            {
            root_0 = (Object)adaptor.nil();

            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:223:20: ( parametre_fonction )*
            loop13:
            do {
                int alt13=2;
                int LA13_0 = input.LA(1);

                if ( (LA13_0==POINTS) ) {
                    alt13=1;
                }


                switch (alt13) {
            	case 1 :
            	    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:223:21: parametre_fonction
            	    {
            	    pushFollow(FOLLOW_parametre_fonction_in_liste_parametres961);
            	    parametre_fonction79=parametre_fonction();

            	    state._fsp--;

            	    adaptor.addChild(root_0, parametre_fonction79.getTree());

            	    }
            	    break;

            	default :
            	    break loop13;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "liste_parametres"

    public static class parametre_fonction_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "parametre_fonction"
    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:224:1: parametre_fonction : ':' CHAINE ;
    public final LogoParser.parametre_fonction_return parametre_fonction() throws RecognitionException {
        LogoParser.parametre_fonction_return retval = new LogoParser.parametre_fonction_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token char_literal80=null;
        Token CHAINE81=null;

        Object char_literal80_tree=null;
        Object CHAINE81_tree=null;

        try {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:224:20: ( ':' CHAINE )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:224:22: ':' CHAINE
            {
            root_0 = (Object)adaptor.nil();

            char_literal80=(Token)match(input,POINTS,FOLLOW_POINTS_in_parametre_fonction970); 
            CHAINE81=(Token)match(input,CHAINE,FOLLOW_CHAINE_in_parametre_fonction973); 
            CHAINE81_tree = (Object)adaptor.create(CHAINE81);
            adaptor.addChild(root_0, CHAINE81_tree);

            tmp.addNomParam(CHAINE81.getText()); empileNomParam("PARAM_"+CHAINE81.getText());

            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "parametre_fonction"

    public static class appel_procedure_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "appel_procedure"
    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:225:1: appel_procedure : ( CHAINE valeur_params ) ;
    public final LogoParser.appel_procedure_return appel_procedure() throws RecognitionException {
        LogoParser.appel_procedure_return retval = new LogoParser.appel_procedure_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token CHAINE82=null;
        LogoParser.valeur_params_return valeur_params83 = null;


        Object CHAINE82_tree=null;

        try {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:225:17: ( ( CHAINE valeur_params ) )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:225:19: ( CHAINE valeur_params )
            {
            root_0 = (Object)adaptor.nil();

            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:225:19: ( CHAINE valeur_params )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:225:20: CHAINE valeur_params
            {
            CHAINE82=(Token)match(input,CHAINE,FOLLOW_CHAINE_in_appel_procedure983); 
            CHAINE82_tree = (Object)adaptor.create(CHAINE82);
            root_0 = (Object)adaptor.becomeRoot(CHAINE82_tree, root_0);

            pushFollow(FOLLOW_valeur_params_in_appel_procedure986);
            valeur_params83=valeur_params();

            state._fsp--;

            adaptor.addChild(root_0, valeur_params83.getTree());

            }

             appelProc(CHAINE82.getText()); 

            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "appel_procedure"

    public static class valeur_params_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "valeur_params"
    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:226:1: valeur_params : ( ( expr )* ) -> ^( VALUES ( expr )* ) ;
    public final LogoParser.valeur_params_return valeur_params() throws RecognitionException {
        LogoParser.valeur_params_return retval = new LogoParser.valeur_params_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        LogoParser.expr_return expr84 = null;


        RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
        try {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:226:15: ( ( ( expr )* ) -> ^( VALUES ( expr )* ) )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:226:17: ( ( expr )* )
            {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:226:17: ( ( expr )* )
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:226:18: ( expr )*
            {
            // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:226:18: ( expr )*
            loop14:
            do {
                int alt14=2;
                int LA14_0 = input.LA(1);

                if ( (LA14_0==CAP||LA14_0==HASARD||LA14_0==LOOP||LA14_0==SIN||LA14_0==POINTS||LA14_0==REEL||LA14_0==48) ) {
                    alt14=1;
                }


                switch (alt14) {
            	case 1 :
            	    // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:226:19: expr
            	    {
            	    pushFollow(FOLLOW_expr_in_valeur_params998);
            	    expr84=expr();

            	    state._fsp--;

            	    stream_expr.add(expr84.getTree());
            	    ajouterValParam(0);

            	    }
            	    break;

            	default :
            	    break loop14;
                }
            } while (true);


            }



            // AST REWRITE
            // elements: expr
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (Object)adaptor.nil();
            // 226:49: -> ^( VALUES ( expr )* )
            {
                // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:226:52: ^( VALUES ( expr )* )
                {
                Object root_1 = (Object)adaptor.nil();
                root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(VALUES, "VALUES"), root_1);

                // D:\\Projets\\workspace\\tp2\\src\\logoparsing\\Logo.g:226:61: ( expr )*
                while ( stream_expr.hasNext() ) {
                    adaptor.addChild(root_1, stream_expr.nextTree());

                }
                stream_expr.reset();

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "valeur_params"

    // Delegated rules


 

    public static final BitSet FOLLOW_term_in_expr500 = new BitSet(new long[]{0x0000006000000002L});
    public static final BitSet FOLLOW_PLUS_in_expr506 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_MINUS_in_expr511 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_term_in_expr517 = new BitSet(new long[]{0x0000006000000002L});
    public static final BitSet FOLLOW_term2_in_term533 = new BitSet(new long[]{0x0000018000000002L});
    public static final BitSet FOLLOW_MULT_in_term540 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_DIV_in_term545 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_term2_in_term550 = new BitSet(new long[]{0x0000018000000002L});
    public static final BitSet FOLLOW_REEL_in_term2565 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_hasardexpr_in_term2568 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_math_in_term2572 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_48_in_term2577 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_expr_in_term2579 = new BitSet(new long[]{0x0002000000000000L});
    public static final BitSet FOLLOW_49_in_term2580 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_LOOP_in_term2586 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_CAP_in_term2591 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_POINTS_in_term2596 = new BitSet(new long[]{0x0000400000000000L});
    public static final BitSet FOLLOW_CHAINE_in_term2599 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_liste_instructions_in_programme618 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_instruction_in_liste_instructions636 = new BitSet(new long[]{0x000040001B6BDFE2L});
    public static final BitSet FOLLOW_LC_in_instruction649 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_BC_in_instruction654 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_VE_in_instruction659 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_MT_in_instruction664 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_CT_in_instruction669 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_AV_in_instruction678 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_TD_in_instruction683 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_TG_in_instruction688 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_REC_in_instruction693 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_FCAP_in_instruction698 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_FCC_in_instruction703 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_expr_in_instruction707 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_FPOS_in_instruction713 = new BitSet(new long[]{0x0004000000000000L});
    public static final BitSet FOLLOW_50_in_instruction716 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_expr_in_instruction719 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_expr_in_instruction721 = new BitSet(new long[]{0x0008000000000000L});
    public static final BitSet FOLLOW_51_in_instruction723 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_TANTQUE_in_instruction730 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_boolexpr_in_instruction733 = new BitSet(new long[]{0x0004000000000000L});
    public static final BitSet FOLLOW_liste_in_instruction735 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_REPETE_in_instruction741 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_expr_in_instruction744 = new BitSet(new long[]{0x0004000000000000L});
    public static final BitSet FOLLOW_liste_in_instruction746 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_IF_in_instruction753 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_boolexpr_in_instruction756 = new BitSet(new long[]{0x0004000000000000L});
    public static final BitSet FOLLOW_liste_in_instruction758 = new BitSet(new long[]{0x0004000000000002L});
    public static final BitSet FOLLOW_liste_in_instruction760 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_LOCALE_in_instruction766 = new BitSet(new long[]{0x0000000020000000L});
    public static final BitSet FOLLOW_GUILLEMETS_in_instruction769 = new BitSet(new long[]{0x0000400000000000L});
    public static final BitSet FOLLOW_CHAINE_in_instruction772 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_DONNE_in_instruction780 = new BitSet(new long[]{0x0000000020000000L});
    public static final BitSet FOLLOW_GUILLEMETS_in_instruction783 = new BitSet(new long[]{0x0000400000000000L});
    public static final BitSet FOLLOW_CHAINE_in_instruction786 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_expr_in_instruction790 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_POUR_in_instruction798 = new BitSet(new long[]{0x0000400000000000L});
    public static final BitSet FOLLOW_CHAINE_in_instruction801 = new BitSet(new long[]{0x0000000040000000L});
    public static final BitSet FOLLOW_liste_p_in_instruction805 = new BitSet(new long[]{0x000040001B6BDFE0L});
    public static final BitSet FOLLOW_blockPour_in_instruction807 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_appel_procedure_in_instruction812 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_RETURN_in_instruction816 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_expr_in_instruction819 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_50_in_liste837 = new BitSet(new long[]{0x000040001B6BDFE0L});
    public static final BitSet FOLLOW_liste_instructions_in_liste840 = new BitSet(new long[]{0x0008000000000000L});
    public static final BitSet FOLLOW_51_in_liste842 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_liste_instructions_in_blockPour860 = new BitSet(new long[]{0x0000000000800000L});
    public static final BitSet FOLLOW_FIN_in_blockPour862 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_HASARD_in_hasardexpr880 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_expr_in_hasardexpr883 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_SIN_in_math891 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_expr_in_math894 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_expr_in_boolexpr903 = new BitSet(new long[]{0x0000001F80000000L});
    public static final BitSet FOLLOW_EGAL_in_boolexpr907 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_INF_in_boolexpr912 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_SUP_in_boolexpr917 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_DIFF_in_boolexpr922 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_INFEQ_in_boolexpr927 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_SUPEQ_in_boolexpr931 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_expr_in_boolexpr935 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_liste_parametres_in_liste_p944 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_parametre_fonction_in_liste_parametres961 = new BitSet(new long[]{0x0000000040000002L});
    public static final BitSet FOLLOW_POINTS_in_parametre_fonction970 = new BitSet(new long[]{0x0000400000000000L});
    public static final BitSet FOLLOW_CHAINE_in_parametre_fonction973 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_CHAINE_in_appel_procedure983 = new BitSet(new long[]{0x0001200044142000L});
    public static final BitSet FOLLOW_valeur_params_in_appel_procedure986 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_expr_in_valeur_params998 = new BitSet(new long[]{0x0001200044142002L});

}